#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define XH(i,a,b) for(int i = a; i < b; ++i)
#define XXH(i,b,a) for(int i = b; i >= a; --i)
#define Module 998244353
int tmpInt;ll tmpll;string tmpStr;char tmpChar;
vector<int>tmpIntVector;

ll mystoll(string str){
  stringstream ss(str);
  ss>>tmpll;
  return tmpll;
}

int main(){
  #ifndef ONLINE_JUDGE
    auto start_clock = clock();
//   freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
  #endif
  ll n;
  cin>>n;
  tmpStr = "999";
  ll ans = 0;
  ll left=999,right;
  int cnt = 1;
  while(n > left){
    tmpStr += "999";
    right = min(n,mystoll(tmpStr));
    ans += (right - left)*cnt;
    ++cnt;
    left = right;
  }
  printf("%lld\n",ans);

  
  
  #ifndef ONLINE_JUDGE
    auto end_clock = clock();
    //cout<<"runtime: "<<end_clock - start_clock<<"ms"<<endl;
  #endif
  return 0;
}
